<?php
   //获取前端传过来的id 将数据库对应的id的数据删除

   //获取前端传过来的参数
   $id = $_GET['id'];

   $conn = mysqli_connect('localhost', 'root', 'root', '2008');
   mysqli_query($conn, "set charset 'utf8'");
   mysqli_query($conn, "set character set 'utf8'");

   //删除语句
   $sql = "delete from shop where id=$id";
   $res = mysqli_query($conn,$sql);
   if($res){
      echo json_encode(array(
         'code' => 200,
         'body' => array(
            'msg' => '删除成功'
         )
         ));
   }else{
      echo json_encode(array(
         'code' => 201,
         'body' => array(
            'msg' => '网络错误,请重试'
         )
         ));
   }
?>